module.exports = {
  //失败响应
  error: (req, res, next) => {
    res.error = (msg = '请求失败', code = 400, data = null) => res.json({ msg, code, data })
    next()
  },
  //成功响应
  success: (req, res, next) => {
    res.success = (msg = '请求成功', code = 200, data = null) => res.json({ msg, code, data })
    next()
  }
}